<template>
	<view class="evaluate-list" v-if="listData.length">
		<view class="header">
			<view class="title">评价</view>
			<view class="good">
				<text style="margin-right: 8rpx;">好评率{{goodsPercent}}%</text>
				<u-icon name="arrow-right" size="8" color="#5A5A5A"></u-icon>
			</view>
		</view>

		<view class="list">
			<view class="list-item" v-for="(item,inex) in listData" :key="index">
				<view class="cell">
					<view class="info">
						<image src="https://cdn.uviewui.com/uview/swiper/swiper2.png" mode="aspectFill" class="image">
						</image>
						<view class="name">{{item.creator||''}}</view>
						<view class="start" v-for="i in item.goodsStar"></view>
					</view>
					<view class="time">{{item.creatorTime | itemCreatorTime}}</view>
				</view>
				<view class="content">{{item.goodsType}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		listWcComment,
		getSettingData
	} from "@/culturalCreativity/http/my.js";
	import {
		realmName
	} from "@/http";
	import {
		dateFormat
	} from "@/utils/pay.js"
	export default {
		data() {
			return {
				value: 5,
				realmName,
				listData: [],
				goodsPercent: ""
			}
		},
		methods: {
			async init(goodsId) {
				let res1 = await getSettingData();
				this.goodsPercent = res1.data.data.feedbackRate;
				let res2 = await listWcComment({
					pageNum: 1,
					pageSize: 9999,
					goodsPercent: this.goodsPercent,
					goodsId
				});
				this.listData = res2.data.rows;
				console.log('评价列表：',res2.data.rows)
			}
		},
		filters: {
			itemCreatorTime(str) {
				return dateFormat("YYYY-mm-dd HH:MM:SS", new Date(str))
			}
		}
	}
</script>
<style lang="scss" scoped>
	.evaluate-list {
		padding: 32rpx;
		background-color: #FFFFFF;
		border-radius: 30rpx;

		.list {
			.list-item {
				padding: 24rpx 0;

				&+.list-item {
					border-top: 1px solid #EEEEEE;
				}

				.content {
					margin-top: 12rpx;
					font-size: 24rpx;
					font-weight: 400;
					color: #878787;
				}

				.cell {
					display: flex;
					justify-content: space-between;

					.time {
						font-size: 24rpx;
						font-weight: 400;
						color: #878787;
					}

					.info {
						display: flex;
						align-items: center;

						.image {
							width: 40rpx;
							height: 40rpx;
							border-radius: 50%;
						}

						.name {
							font-size: 24rpx;
							font-weight: 400;
							color: #1F1F1F;
							margin: 0 32rpx 0 16rpx;
						}

						.start {
							width: 24rpx;
							height: 24rpx;
							background: url() center/cover no-repeat;

							&+.start {
								margin-left: 8rpx;
							}
						}
					}
				}
			}
		}

		.header {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.title {
				padding-left: 14rpx;
				font-size: 28rpx;
				font-weight: 500;
				color: #1F1F1F;
				position: relative;

				&::after {
					content: "";
					left: 0;
					top: 50%;
					margin-top: -3rpx;
					width: 6rpx;
					height: 30rpx;
					background: #FD8F19;
					border-radius: 3rpx;
				}
			}

			.good {
				display: flex;
				align-items: center;
				font-size: 22rpx;
				font-weight: 400;
				color: #5A5A5A;
			}
		}
	}
</style>
